angular.module('demoModule', ['LocalStorageModule'])
  .config(['localStorageServiceProvider', function(localStorageServiceProvider){
    localStorageServiceProvider.setPrefix('demoPrefix');
    // localStorageServiceProvider.setStorageCookieDomain('example.com');
    // localStorageServiceProvider.setStorageType('sessionStorage');
  }])
  .controller('DemoCtrl', [
    '$scope',
    'localStorageService',
    function($scope, localStorageService) {

      $scope.$watch('localStorageDemo', function(value){
        localStorageService.set('localStorageDemo',value);
        $scope.localStorageDemoValue = localStorageService.get('localStorageDemo');
      });

      $scope.storageType = 'Local storage';

      if (localStorageService.getStorageType().indexOf('session') >= 0) {
        $scope.storageType = 'Session storage';
      }

      if (!localStorageService.isSupported) {
        $scope.storageType = 'Cookie';
      }
    }
  ]);